package com.quanquan.user.controller.statisticsReport;

import base.BaseController;
import com.quanquan.user.request.SignInRequestBody;
import com.quanquan.user.service.statisticsReport.SigninReportService;
import enums.ResCodeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import web.response.ResultBody;

import java.util.Map;

/**
 * 功能描述:优惠券统计报表
 *
 * @ClassName: CouponReportController
 * @Author: xiongjunbao
 * @Date: 2019-05-30 10:31
 * @Version: V1.0
 */
@RestController
@RequestMapping("/signin_num")
public class SigninReportController extends BaseController {
    private final SigninReportService signinReportService;

    @Autowired
    public SigninReportController(SigninReportService signinReportService) {
        this.signinReportService = signinReportService;
    }


    /**
     * 停车数量统计 分日、周、月、年
     *
     * @return
     */
    @PostMapping("/signin_num")
    public ResultBody signinNum(@RequestBody SignInRequestBody request) {
        //获取当前时间
        Map<String, Object> map = signinReportService.signinNum(request);
        if (map.isEmpty()){
            return new ResultBody(ResCodeEnum.NO_DATA.getCode(), "暂无数据");
        }
        return new ResultBody(ResCodeEnum.SUCCESS.getCode(), "SUCCESS",map);
    }

}
